{include file="main/general_header.html"}

<script type="text/javascript">
{literal}
$(document).ready(function(){
	var leftHeight = $('#leftcolumn').height();
	var rightHeight = $('#body').height();
	if(leftHeight > rightHeight) {
		$('#content').css('min-height', leftHeight + 30);
	} else {
		$('#content').css('min-height', rightHeight + 30);
	}
	$('#quickSearch').keypress(function(e) {
		if (e.which == 13){
			fastSearchPatientCode();
		}
	});

	//temporary added by Viet Hoang , remove in release
	//add support select language
	$('#language').change(function () {
		window.location.href="SelectLanguage?lang=" + $(this).val() + '&ac=' + window.location.href;			
	});
	//end
});

var switcher;
function switchTimer() {
	var timer = 5000;
	clearTimeout(switcher);
	switcher = setTimeout('showNavTab(\''+ currentMainNav +'\');', timer);
}
{/literal}

{if $me->get_id() > 0}
	{literal}
		$(document).ready(function() {
			 setInterval("getNewMessageAlert()", 30000);
			 getRecentPatient();
		});
		
	function getNewMessageAlert(){
		$.get (
			'../InstantMessage/getNewMessageAlert?set_ajax_view',
			{
			},
			function(data) {	
				if (data.value > 0){
					$('#newMessageAlert').html("<a href='../InstantMessage/viewMessages' onclick='redirectToMessagePage()'><span style='color: yellow;'>" + data.sender + ":</span> " + data.message + "</a>").slideDown();
					setTimeout("removeAlert()", 10000);
				}
			},
			"json"
			);
	}
	
	function removeAlert(){
		$('#newMessageAlert').html("").slideUp();
	}
	
	function redirectToMessagePage(){
		$.get(
			'../InstantMessage/redirectToMessagePage',
			{},
			function(data){
				$('#maincontainer').html(data);
			}
		);
	}
	{/literal}
{/if}
</script>
<div id="maincontainer">
	<div id="header">

		<div id="topsection">				
			<div class='messageAlert' id='newMessageAlert'></div>			
			<div align="right""> <select name="language" id='language' selected='{$chosenLanguage}'>
						{html_options options=$languageList selected=$chosenLanguage}
					</select>
			</div>
		</div>
		<div></div>
		<div style="clear: both;"></div>
		{if $me->get_id() > 0}
		<div id="menusection">
			<div class="chromestyle" id="chromemenu">
				{include file="main/general_menu.html"}
			</div>
		</div>
		{/if}
		<div style="clear: both"></div>
	</div>

	<input type="hidden" name="menu_mode" id="menu_mode" value="none">
	<div id="content">
		<div id="leftcolumn">
			{include file="main/general_left_column.html"}
			<div style="clear: both;"></div>
		</div>
	
		{include file="main/general_confidentiality.html"}		
		<div id="body">
	        {if is_object($messages)}
	        	{$messages->render()}
	        {elseif is_array($messages)}
	            {foreach from=$messages item=message}
					{if is_array($message)}
	                	{$message.title} {$message.message}
					{else}
						{$message}
					{/if}
					<br>
	            {/foreach}
	        {elseif strlen($messages) >0}
	        	{$messages}
	        {/if}
	        {$display}
		</div>
	</div>
	<div id="footer">
		{translate p1='<a href="http://www.lhvsoftware.com" targer="_blank">' p2='</a>'}Copyright (c) 2008 - 2009 %sLHV Software%s{/translate}.
		<div class='separator'></div>
		<div>
			<a href="http://www.lhvsoftware.com" targer="_blank">
				<img border='0' src='../images/lhv_logo.png'/>
			</a>
		</div>
	</div>
</div>
</body>
</html>
